/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author David
 */
@Entity
@Table(name = "tractament")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tractament.findAll", query = "SELECT t FROM Tractament t"),
    @NamedQuery(name = "Tractament.findById", query = "SELECT t FROM Tractament t WHERE t.id = :id"),
    @NamedQuery(name = "Tractament.findByDataTractament", query = "SELECT t FROM Tractament t WHERE t.dataTractament = :dataTractament"),
    @NamedQuery(name = "Tractament.findByDosis", query = "SELECT t FROM Tractament t WHERE t.dosis = :dosis"),
    @NamedQuery(name = "Tractament.findByQuantitatDisolucio", query = "SELECT t FROM Tractament t WHERE t.quantitatDisolucio = :quantitatDisolucio"),
    @NamedQuery(name = "Tractament.findByQuantitatTotal", query = "SELECT t FROM Tractament t WHERE t.quantitatTotal = :quantitatTotal"),
    @NamedQuery(name = "Tractament.findByObservacions", query = "SELECT t FROM Tractament t WHERE t.observacions = :observacions")})
public class Tractament implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "data_tractament")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dataTractament;
    @Basic(optional = false)
    @Column(name = "dosis")
    private float dosis;
    @Basic(optional = false)
    @Column(name = "quantitat_disolucio")
    private float quantitatDisolucio;
    @Basic(optional = false)
    @Column(name = "quantitat_total")
    private float quantitatTotal;
    @Column(name = "observacions")
    private String observacions;
    @JoinColumn(name = "mode_aplicacio_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private ModeAplicacio modeAplicacioId;
    @JoinColumn(name = "produccio_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Produccio produccioId;
    @JoinColumn(name = "fitosanitari_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Fitosanitari fitosanitariId;

    public Tractament() {
    }

    public Tractament(Integer id) {
        this.id = id;
    }

    public Tractament(Integer id, Date dataTractament, float dosis, float quantitatDisolucio, float quantitatTotal) {
        this.id = id;
        this.dataTractament = dataTractament;
        this.dosis = dosis;
        this.quantitatDisolucio = quantitatDisolucio;
        this.quantitatTotal = quantitatTotal;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getDataTractament() {
        return dataTractament;
    }

    public void setDataTractament(Date dataTractament) {
        this.dataTractament = dataTractament;
    }

    public float getDosis() {
        return dosis;
    }

    public void setDosis(float dosis) {
        this.dosis = dosis;
    }

    public float getQuantitatDisolucio() {
        return quantitatDisolucio;
    }

    public void setQuantitatDisolucio(float quantitatDisolucio) {
        this.quantitatDisolucio = quantitatDisolucio;
    }

    public float getQuantitatTotal() {
        return quantitatTotal;
    }

    public void setQuantitatTotal(float quantitatTotal) {
        this.quantitatTotal = quantitatTotal;
    }

    public String getObservacions() {
        return observacions;
    }

    public void setObservacions(String observacions) {
        this.observacions = observacions;
    }

    public ModeAplicacio getModeAplicacioId() {
        return modeAplicacioId;
    }

    public void setModeAplicacioId(ModeAplicacio modeAplicacioId) {
        this.modeAplicacioId = modeAplicacioId;
    }

    public Produccio getProduccioId() {
        return produccioId;
    }

    public void setProduccioId(Produccio produccioId) {
        this.produccioId = produccioId;
    }

    public Fitosanitari getFitosanitariId() {
        return fitosanitariId;
    }

    public void setFitosanitariId(Fitosanitari fitosanitariId) {
        this.fitosanitariId = fitosanitariId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tractament)) {
            return false;
        }
        Tractament other = (Tractament) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Tractament[ id=" + id + " ]";
    }
    
}
